package com.example.shushiyunsst.util.push.helper;

import com.example.library_common.global.AppGlobals;
import com.example.shushiyunsst.R;
import com.example.shushiyunsst.util.push.helper.android.AndroidBroadcast;
import com.example.shushiyunsst.util.push.helper.android.AndroidUnicast;

public class PushHelper {

    private static String appkey = AppGlobals.getApplication().getString(R.string.m_app_push_key);
    private static String appMasterSecret = AppGlobals.getApplication().getString(R.string.app_master_secret);
    private PushClient client = new PushClient();

    public static AndroidUnicast getAndroidBroadcast() throws Exception {
        AndroidUnicast unicast = new AndroidUnicast(appkey, appMasterSecret);
        unicast.goAppAfterOpen();
        unicast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION);
        // TODO Set 'production_mode' to 'false' if it's a test device.
        // For how to register a test device, please see the developer doc.
        unicast.setProductionMode();
        // Set customized fields
        unicast.setExtraField("test", "helloworld");
        unicast.setChannelActivity("your channel activity");
        unicast.setChannelProperties("abc");
        return unicast;
    }
    public void sendAndroidBroadcast(AndroidUnicast broadcast) throws Exception {
        client.send(broadcast);
    }
}
